package operation;

import book.BookList;
import book.ListNode;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: mac
 * Date: 2022-09-08
 * Time: 11:04
 */
public class FindOperation implements IOperation{
    public void work(BookList bookList) {
        System.out.println("查找图书");
        System.out.println("请输入你要查找的图书名字：");
        String bookName = scanner.nextLine();
        ListNode cur = bookList.getHead();
        while (cur != null){
            if (bookName.equals(cur.val.getName())){
                System.out.println(cur.val);
                return;
            }
            cur = cur.next;
        }
        System.out.println("查找书名不存在");
    }
}
